package com.management.department.teacherinfosystem.Repository;

import com.management.department.teacherinfosystem.Entity.Textbook;
import com.management.department.teacherinfosystem.Entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface TextbookRepository extends JpaRepository<Textbook, Long>, JpaSpecificationExecutor<Textbook> {
    List<Textbook> findByUser(User user);

    @Query("select t from Textbook t join fetch t.user")
    List<Textbook> findAllWithUser();
} 